MUNMAP

Section: System Calls (2)
Updated:
Index Return to Main Contents
 

NAME

munmap - unmap part of the process's address space  

SYNOPSIS


NOTE: this man page is inaccurate.
munmap(addr, len)
caddr_t addr;   /* starting virt-addr */
int     len;    /* length (bytes) to unmap */
 

DESCRIPTION

Munmap removes a mapping created by mmap(2). The addr and len arguments must be integral multiples of the system page size, as defined by getpagesize(2).

After successful completion of munmap, the address space from addr through addr+len-1 does not exist and will result in a segmentation fault (SIGSEGV) if referenced.  

RETURN VALUE

Munmap returns zero when successful. Otherwise it returns -1 and places the error number in the global variable errno.  

ERRORS

[EINVAL]
Addr or len is not a multiple of the system page size.
[EINVAL]
The area defined by addr and len overlaps the text or stack segment or a non-existent part of the address space.
 

SEE ALSO

mmap(2), vm_ctl(2), getpagesize(2)  

NOTES

The current implementation can unmap only data space.

Any address space holes created by munmap read as zeroes in a core file.


 

Index

NAME
SYNOPSIS
DESCRIPTION
RETURN VALUE
ERRORS
SEE ALSO
NOTES

This document was created by man2html, using the manual pages.
Time: 04:51:41 GMT, January 31, 2023